#!/usr/bin/env ruby

require 'flgrcore'

def fill_array(size)
  tab = []
  for i in 0..size-1
    tab.push(i)
  end
  return tab
end

def getNhbMin(nhb,extr)
  return extr[2].min
end

minFct = Proc.new{|nhb,extr| getNhbMin(nhb,extr)}


imin = Flgrcore::flgr2d_load_pgm("../../apps/images/gray/lena.pgm")
imin2 = Flgrcore::FLGR_Data2D.new(imin.sizeX,imin.sizeY,Flgrcore::FLGR_UINT8)
imin3 = Flgrcore::FLGR_Data2D.new(imin.sizeX,imin.sizeY,Flgrcore::FLGR_UINT8)
imout = Flgrcore::FLGR_Data2D.new(imin.sizeX,imin.sizeY,Flgrcore::FLGR_UINT8)
nhbsquare = Flgrcore::FLGR_Data2D.new(3,3,Flgrcore::FLGR_UINT8,Flgrcore::FLGR_RECT,Flgrcore::FLGR_8_CONNEX)


Flgrcore::flgr2d_raster_slide_window(imout,imin,nhbsquare,Flgrcore::FLGR_NHB_NO_SYM, minFct)



Flgrcore::flgr2d_save_pgm(imout,"out.pgm")

